package n3349;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Node{
	Node next;
	int index;
}

public class Main {

	
	static int[][] global=new int[100001][6];
	
	static final int N=10000;
	
	static BufferedReader cin = new BufferedReader(new InputStreamReader(System.in));
	
	//static Scanner cin=new Scanner(new BufferedInputStream(System.in));
	/**
	 * @param args 
	 */
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		
		if(solve()){
			System.out.println("Twin snowflakes found.");
			return;
		}
		
		System.out.println("No two snowflakes are alike.");
		
	}
	
	static boolean solve() throws Exception
	{
		
		
		int total = Integer.parseInt(cin.readLine());
		
		Node vsnode[]=new Node[N];
		
		for(int i=0;i<total;i++)
		{
			int sum=0;
			StringTokenizer st=new StringTokenizer(cin.readLine());
			for(int j=0;j<6;j++){
				global[i][j]=Integer.parseInt(st.nextToken());
				sum+=global[i][j];
			}
			if(vsnode[sum%N]!=null)
			{
				Node node=vsnode[sum%N];
				Node n= new Node();
				n.next=node;
				n.index=i;
				vsnode[sum%N]=n;
			}else{
				Node n= new Node();
				n.next=null;
				n.index=i;
				vsnode[sum%N]=n;
			}
		}
		 for(int i=0;i<N;i++)
	        {
	            for(Node n1=vsnode[i]; n1!=null; n1=n1.next)
	                for(Node n2=n1.next; n2!=null; n2=n2.next)
	                    if(check(n1.index,n2.index))return true;
	        }
		return false;
	}
	
	
	
	static boolean check(int a,int b)
	{
		for(int j=0;j<6;j++)
		{
			int count=0,p=0,r=j;
			while(count<6&&global[a][p]==global[b][r])
			{
				p=(p+1)%6;
				r=(r+1)%6;
				count++;
			}
			if(count==6)return true;
			count=0;p=0;r=j;
			while(count<6&&global[a][p]==global[b][r])
			{
				p=(p+1)%6;
				r=(r-1+6)%6;
				count++;
			}
			if(count==6)return true;
		}
		return false;
	}

}
